home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / aijournl / 1986_10 / vtprolog.doc < prev    next >
Text File  |  1986-07-14  |  4KB  |  99 lines

  1.                       VT-PROLOG - Very Tiny Prolog
  2.  
  3.  
  4. VT-PROLOG  is a simple prolog interpreter provided with full source  code 
  5. to encourage experimentation with PROLOG.
  6.  
  7. Startup
  8. 1. Boot the system.
  9. 2. Insert the disk containing VTPROLOG.COM in Drive A:
  10. 3. If the DOS prompt is not A>, type A: and press the ENTER key to switch 
  11.    to drive A:.
  12. 4. Type VTPROLOG and press RETURN. VTPROLOGshould respond withits heading 
  13.    and a '-> ' prompt.
  14.  
  15. Loading a data base
  16. 1. You may enter rules and queries directlty from the keyboard. The        
  17.    syntax of both queries and rules is described below. Be sure to 
  18.    terminate all queries, rules and commands with a period.
  19. 2. Data bases may be stored as ASCII text files. To read a text file type 
  20.    the command:
  21.          @ filename .
  22.    where filename is a legitimate DOS filename, the default extension is 
  23.    'PRO'. If the filename contains a ':', '.' or a '\' then it must be 
  24.    enclosed in single quotes. For example, the following are legitmate 
  25.    file commands:
  26.          @ wine .
  27.          @ 'b:wine.pro' .
  28.          @ 'c:\prolog\test\wine' .
  29. 3. VTPROLOG will read and compile the text file. Any queries included in 
  30.    the file will be executed just as if they had been typed from the 
  31.    keyboard.
  32. 4. Data base files may contain commands to read to other data base files.
  33.  
  34. Terminating VTPROLOG
  35. 1. To exit VTPROLOG, type :
  36.           exit .
  37.    at the '-> ' prompt. Don't forget the period.
  38.  
  39. VTPROLOG Grammar
  40.    The following BNF describes the syntax of VTPROLOG rules and queries:
  41.  
  42.      sentence ::- rule | query | command
  43.      rule ::- head '.' | head ':-' tail '.'
  44.      query ::- '?-' tail '.'
  45.      command ::- '@' file_name '.'
  46.      head ::- goal
  47.      tail ::- goal | goal ',' tail
  48.      goal ::- constant | variable | structure
  49.      constant ::- {quoted string} | {token beginning with 'a' .. 'z'}
  50.      variable ::- {identifier beginning with 'A' .. 'Z' or '_' }
  51.      structure ::- functor '(' component_list ')'
  52.      functor ::- {token beginning with 'a' .. 'z'}
  53.      component_list ::- goal | goal ',' components_list
  54.      file_name ::- {legitimate DOS file name, must be surrounded with
  55.                     single quotes if it contains a '.',':' or '\'}
  56.  
  57.    Examples of legitimate data base statements are:
  58.  
  59.        likes(john,X) :- likes(X,wine) , female(X) .
  60.        likes(joan,wine) .
  61.        likes(alice,candy) .
  62.        male(john) .
  63.        female(alice) .
  64.        female(joan) .
  65.  
  66.    An example of a legitimate query for this data base would be:
  67.  
  68.        ?- likes(john,Who) .
  69.  
  70.    VTPROLOG should respond:
  71.       
  72.        Who = joan
  73.  
  74.    At this point you may type ';' to continue to search for other 
  75.    solutions to the query, or press the 'Enter' key to terminate the 
  76.    query. If VTPROLOG cannot find a solution to a query it responds 'No'
  77.    to indicate that no solution exits to the query at this point.
  78.  
  79.    Constant,  variable  or  functor names may be up to 80  characters  in 
  80.    length.   Constants  beginning  with  capital  letters  or  containing 
  81.    imbedded blanks, commas, paraenthesis or periods must be surrounded by 
  82.    single quote marks.
  83.  
  84.    From time to time you may see a '*' displayed on the screen as a query 
  85.    is being evaluated. This means that garbage collection is in progress. 
  86.    The '*' will be erased when collection is completed.
  87.  
  88.    Good  luck  with VTPROLOG.  We would be very interested in hearing  of 
  89.    your experiments,  enhancements or even (gasp) bugs that you may find. 
  90.    Please write to us with your comments or questions.
  91.  
  92.           Bill and Bev Thompson
  93.           C/O AI Expert Magazine
  94.           650 5th St.
  95.           Suite 311
  96.           San Francisco, CA 94107
  97.  
  98.